﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SpotsHub.RouteService.Data
{
    [Table("Route_Package")]
    public class Package : EntityBase, ITimeStamp
    {
        #region Required

        //public int OrderId { get; set; }

        public PackageStatus Status { get; set; }
        
        #endregion

        #region Optional

        public int? WarehouseId { get; set; }

        //public int? AssignedDriverId { get; set; }

        #endregion

        #region Navigator

        public virtual Shipment Shipment { get; set; }

        public virtual Warehouse Warehouse { get; set; }

        [NotMapped]
        public virtual Location PickUpLocation
        {
            get
            {
                return Shipment.PickUpLocation;
            }
        }

        [NotMapped]
        public virtual Location DeliveryLocation 
        {
            get
            {
                return Shipment.DeliveryLocation;
            }
        }
        //public virtual Driver AssignedDriver { get; set; }

        #endregion

        #region Other

        public DateTime? LastUpdate { get; set; }

        #endregion
    }

    public enum PackageStatus : byte
    {
        //NotReady,
        ReadyForPickUp,
        Delivering,
        ReturningWarehouse,
        Delivered,
        InWarehouse
    }
}
